<template>
	<view>
		<header-top :messageInfo="{typeFlag:true,message:'忘记密码',liner:true}"></header-top>
		<view class="mainpadding_top">
			<view class="needbot-bor">
				<input type="safe-password" placeholder="请输入密码" v-model="password">
			</view>
			<view class="needbot-bor">
				<input type="safe-password" placeholder="请再次输入密码" v-model="repassword">
			</view>
			<!-- <view class="flexright nostrongtext margin_top" @click="jumpurl('/pages/login/thelogin')">短信验证码登录</view> -->
		</view>
		<view class="mainpadding_top">
			<view class="surebtns flexcenter margin_top" @click="jumpnext">完成</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				mobile:'',
				yzm_code:'',
				password:'',
				repassword:'',
			}
		},
		onLoad(options) {
			let _this = this;
			_this.mobile = options.mobile;
			_this.yzm_code = options.yzm;
		},
		methods: {
			jumpnext(){
				if(this.password==""){
					httpRequest.toast("请输入密码")
					return false
				}
				if(this.repassword==""){
					httpRequest.toast("请再次输入密码")
					return false
				}
				if(this.repassword!=this.password){
					httpRequest.toast("两次输入密码不一致,请重试!")
					return false
				}
				httpRequest.request('/dhtapi/user/resetpwd','POST',{
					mobile:this.mobile,
					captcha:this.yzm_code,
					newpassword:this.password,
				}).then(res => {
					console.log(res);
					if(res.code == 1){
						httpRequest.toast('修改成功')
						setTimeout(function(){
							uni.reLaunch({
								url:'/pages/login/accountlogin'
							})
						},500)
					}else{
						httpRequest.toast(res.msg);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.logintext{
		font-size: 40rpx;
		font-family: PingFang SC-Bold, PingFang SC;
		font-weight: bold;
		color: #000000;
		line-height: 47rpx;
	}
	.needbot-bor{
		margin-top: 40rpx;
		padding-bottom: 20rpx;
		border-bottom: 1rpx solid rgba(153, 153, 153, 0.06);
	}
	.sendcode{
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #0BBDCB;
	}
	.nostrongtext{
		font-weight: 500;
	}
	.smalltext{
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #999999;
	}
	.maincolor_text{
		color: #0BBDCB;
	}
</style>
